package com.atguigu.gulimall.order.web;

import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

@Controller
public class OrderListController {
    @Autowired
    OrderService orderService;
    @GetMapping("/orderList.html")
    public String orderList(@RequestParam(value = "page",required = false,defaultValue = "1") Integer page, Model model){
        Map<String,Object> param=new HashMap<>();
        param.put("param",page.toString());
        PageUtils pageUtils =orderService.getOrderList(param);
        model.addAttribute("page",pageUtils);
        return "list";
    }
}
